package com.tanhua.server.test;

import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

@SpringBootTest
@RunWith(SpringRunner.class)
public class testUpload {
    @Autowired
    private FastFileStorageClient client;

    @Test
    public void testUpload() throws FileNotFoundException {
        File file = new File("C:\\Users\\26697\\Pictures\\Saved Pictures\\66.jpg");
        InputStream inputStream = new FileInputStream(file);
        StorePath storePath=client.uploadFile(inputStream,file.length(),"jpg",null);

        System.out.println(storePath.getFullPath());
    }
}
